package com.spotalog.shared.model;

import java.util.List;

import javax.annotation.Nonnegative;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import com.googlecode.objectify.annotation.Cache;
import com.googlecode.objectify.annotation.Embed;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Index;

@Entity
@Data
@Cache
@XmlRootElement
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class Spot extends DatastoreObject implements Locatable {
	@NotNull
	@Size(min = 2)
	private String name;
	private String description;
	@Nonnegative
	private int upVotes;
	@Nonnegative
	private int downVotes;
	@NotNull
	private SpotType type;
	@Embed
	private Address address;
	@NotNull
	@Embed
	private Location location;
	@Index
	@Embed
	private List<Photo> photos;

	public static final String NAME = "name";
	public static final String DESCRIPTION = "description";
	public static final String UP_VOTES = "upVotes";
	public static final String DOWN_VOTES = "downVotes";
	public static final String TYPE = "type";
	public static final String ADDRESS = "address";
	public static final String LOCATION = "location";
	public static final String PHOTOS = "photos";
}
